package com.hl.sfzy.controller;

import com.hl.sfzy.entity.SearchCourse;
import com.hl.sfzy.entity.SearchMark;
import com.hl.sfzy.entity.SearchProAndAns;
import com.hl.sfzy.entity.SearchTeacher;
import com.hl.sfzy.service.SearchTeacherByIdService;
import com.hl.sfzy.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/teacher/search")
public class SearchTeacherByIdController {

    @Autowired
    private SearchTeacherByIdService searchTeacherByIdService;

    //根据id查询个人信息，问题答案，评论课程
    @GetMapping("/ConsultantDetails")
    public R ConsultantDetails(Integer teacherId){
        Map map = searchTeacherByIdService.consultantDetails(teacherId);
        return R.success(map);
    }
    //根据id查询评价
    @GetMapping("/userMark")
    public R searchUserMark(Integer teacherId) {
        List<SearchMark> userMarkList=searchTeacherByIdService.searchUserMark(teacherId);
        return R.success(userMarkList);
    }
    //根据id查询问题答案
    @GetMapping("/proAndAnsLimit")
    public R proAndAnsLimit() {
        List<SearchProAndAns> proAndAnsLimit = searchTeacherByIdService.searchProAndAnsLimit();
        return R.success(proAndAnsLimit);
    }
    //根据id查询教师信息
    @GetMapping("/teacher")
    public R teacher(Integer teacherId){
        SearchTeacher teacher = searchTeacherByIdService.searchTeacherById(teacherId);
        return R.success(teacher);
    }
    //根据id查询教师发布课程
    @GetMapping("/course")
    public R course(Integer teacherId){
        List<SearchCourse> searchCourse = searchTeacherByIdService.searchCourseByTeacherId(teacherId);
        return R.success(searchCourse);
    }

}
